import { ChangeDetectionStrategy, Component } from '@angular/core';
import { LvCalendarEvents } from '@iux/live';

const DATE = new Date();
const YEAR = DATE.getFullYear();
const MONTH = DATE.getMonth();
const PRE_MONTH = DATE.getMonth() - 1;
const NEXT_MONTH = DATE.getMonth() + 1;

const Events = [
  {
    id: 4,
    title: '江苏紫金银行客户满意活动4',
    startDate: new Date(YEAR, MONTH, 10),
    endDate: new Date(YEAR, MONTH, 15),
  },
  {
    id: 5,
    title: '江苏紫金银行客户满意活动5',
    startDate: new Date(YEAR, MONTH, 5),
    endDate: new Date(YEAR, MONTH, 8),
  },
  {
    id: 6,
    title: '江苏紫金银行客户满意活动6',
    startDate: new Date(YEAR, MONTH, 21),
    endDate: new Date(YEAR, MONTH, 26),
  },
  {
    id: 7,
    title: '江苏紫金银行客户满意活动7',
    startDate: new Date(YEAR, MONTH, 8),
    endDate: new Date(YEAR, MONTH, 12),
  },
  {
    id: 8,
    title: '江苏紫金银行客户满意活动8',
    startDate: new Date(YEAR, PRE_MONTH, 29),
    endDate: new Date(YEAR, MONTH, 3),
  },
  {
    id: 9,
    title: '江苏紫金银行客户满意活动9',
    startDate: new Date(YEAR, MONTH, 29),
    endDate: new Date(YEAR, NEXT_MONTH, 4),
  },
  {
    id: 10,
    title: '江苏紫金银行客户满意活动10',
    startDate: new Date(YEAR, MONTH, 9),
    endDate: new Date(YEAR, MONTH, 11),
  },
  {
    id: 11,
    title: '江苏紫金银行客户满意活动11',
    startDate: new Date(YEAR, MONTH, 9),
    endDate: new Date(YEAR, MONTH, 11),
  },
  {
    id: 12,
    title: '江苏紫金银行客户满意活动12',
    startDate: new Date(YEAR, MONTH, 9),
    endDate: new Date(YEAR, MONTH, 11),
  },
  {
    id: 13,
    title: '江苏紫金银行客户满意活动13',
    startDate: new Date(YEAR, MONTH, 9),
    endDate: new Date(YEAR, MONTH, 11),
  },
];

@Component({
  templateUrl: './drag.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DragComponent {
  date: Date = DATE;
  events: LvCalendarEvents[] = Events;

  dateChange(date) {
    console.log('dateChange:', date);
  }

  activeDateChange(date) {
    console.log('activeDateChange:' + date.value.localDate);
  }
}
